package com.banshou.installs.ui.adapter;

import android.content.Context;
import android.view.View;

import com.banshou.installs.R;
import com.banshou.installs.model.dao.ResponseXQ;
import com.zhy.adapter.recyclerview.CommonAdapter;
import com.zhy.adapter.recyclerview.base.ViewHolder;

import java.util.List;

/**
 * Created by cjq on 2018/4/19.
 * Email: stoic_yb@139.com
 * features:
 */
public class QXAdapter extends CommonAdapter<ResponseXQ.BuildList> {

    public interface onItemClickListener{
        void getId(String Id,String name,String type);
    }

    public onItemClickListener listener;

    public void setOnItemOnClickListener(onItemClickListener listener){
        this.listener = listener;
    }
    public QXAdapter(Context context, int layoutId, List<ResponseXQ.BuildList> datas) {
        super(context, layoutId, datas);
    }

    @Override
    protected void convert(ViewHolder holder, final ResponseXQ.BuildList buildList, int position) {
        holder.setText(R.id.address, buildList.getLabel());
        holder.setOnClickListener(R.id.main, view -> listener.getId(buildList.getId(),buildList.getLabel(),buildList.getCommunityType().getId()));
    }
}
